#ifndef __File_h__
#define __File_h__

#include <string>
#include "FileSystem/FileSystem.h"

class File
{
private:
	std::string sFileName;
	bool bIsOpened;
	mutable FileHandle fHandle;
public:
	File(const std::string & fileName = "", int modes = FM_OpenRead);
	File(const File&);
	File& operator=(const File&);
	virtual ~File();

	bool IsOpened() const;
	const std::string & GetFileName() const;
	
	bool Open(const std::string & fileName, int modes);
	bool Close();
	
	SSizeType Read(void * data, SizeType nbytes) const;
	SSizeType Write(const void * data, SizeType nbytes);
	
	SSizeType PRead(void * data, SizeType nbytes, SizeType offset) const;
	SSizeType PWrite(const void * data, SizeType nbytes, SizeType offset);
	
	SizeType Seek(SizeType offset, int whence);
	
	bool Truncate(SizeType iNewSize);
};

#endif
